#ifndef _EBN_LINK_H_
#define _EBN_LINK_H_

typedef enum {
    NULL_LINK = 0,
    PREDECCESSOR_LINK = 1,
    SUCCESSOR_LINK = 2,
    CONFLICTOR_LINK = 3,
    RECEPTOR_LINK = 4,
    GOAL_LINK = 5
} LinkType;

/*
typedef enum {
    FROM_GOAL = 0,
    FROM_COMPETENCE_MODULE = 1,
    FROM_RECEPTOR = 2
} SrcNodeType;
*/

class CEbnCondition;
class CEbnEffect;
class CEbnCompetenceModule;
class CEbnGoal;
class CEbnReceptor;
class CEbnProposition;

class CEbnLink
{
public:
    CEbnLink(CEbnProposition * from, CEbnProposition * to);
    ~CEbnLink(void);

    void setDstCompetenceModule(CEbnCompetenceModule * toCM);
    CEbnCompetenceModule * getDstCompetenceModule(void);

    float getActivation();

    LinkType getLinkType(void);
    /*
    SrcNodeType getSrcNodeType(void);
    */


protected:
    void setLinkType(LinkType linkType);
    /*
    void setSrcNodeType(SrcNodeType nodeType);
    */

    CEbnProposition * mpSrcProposition;
    CEbnProposition * mpDstProposition;

    CEbnCompetenceModule * mpDstCompetenceModule;

private:
    LinkType mLinkType;
    /*
    SrcNodeType mSrcNodeType;
    */
};

class CEbnGoalLink : public CEbnLink
{
public:
    CEbnGoalLink(CEbnProposition * from, CEbnProposition * to);
    ~CEbnGoalLink(void);

    void setSrcGoal(CEbnGoal * goal);
    CEbnGoal * getSrcGoal(void);

    bool isFromGoal(CEbnGoal * goal);

    float getActivation(void);
private:

    CEbnGoal * mpSrcGoal;

};

class CEbnReceptorLink : public CEbnLink
{
public:
    CEbnReceptorLink(CEbnProposition * from, CEbnProposition * to);
    ~CEbnReceptorLink(void);

    void setSrcReceptor(CEbnReceptor * receptor);
    CEbnReceptor * getSrcReceptor(void);

    bool isFromReceptor(CEbnReceptor * receptor);

    float getActivation(void);

private:

    CEbnReceptor * mpSrcReceptor;

};

class CEbnPredecessorLink : public CEbnLink
{
public:
    CEbnPredecessorLink(CEbnProposition * from, CEbnProposition * to);
    ~CEbnPredecessorLink(void);

    float getActivation(void);
    void setSrcCompetenceModule(CEbnCompetenceModule * cm);
    CEbnCompetenceModule * getSrcCompetenceModule();

    CEbnCondition * getSrcCondition();
    CEbnEffect * getDstEffect();

    bool isFromCompetenceModule(CEbnCompetenceModule * cm);

private:

    CEbnCompetenceModule * mpSrcCompetenceModule;

};

class CEbnSuccessorLink : public CEbnLink
{
public:
    CEbnSuccessorLink(CEbnProposition * from, CEbnProposition * to);
    ~CEbnSuccessorLink(void);

    float getActivation();
    void setSrcCompetenceModule(CEbnCompetenceModule * cm);
    CEbnCompetenceModule * getSrcCompetenceModule();

    CEbnEffect * getSrcEffect();
    CEbnCondition * getDstCondition();

    bool isFromCompetenceModule(CEbnCompetenceModule * cm);

private:

    CEbnCompetenceModule * mpSrcCompetenceModule;

};

class CEbnConflictorLink : public CEbnLink
{
public:
    CEbnConflictorLink(CEbnProposition * from, CEbnProposition * to);
    ~CEbnConflictorLink(void);

    float getActivation(void);
    void setSrcCompetenceModule(CEbnCompetenceModule * cm);
    CEbnCompetenceModule * getSrcCompetenceModule();

    bool isFromCompetenceModule(CEbnCompetenceModule * cm);

    CEbnEffect * getSrcEffect();
    CEbnCondition * getDstCondition();

private:

    CEbnCompetenceModule * mpSrcCompetenceModule;

};

#endif
